package com.meteor.web.controller;

import com.meteor.util.BlogBean;
import com.meteor.service.BlogService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import javax.annotation.Resource;
import java.util.List;

@Controller
public class WebSearchController {

    @Resource
    private BlogService blogService;

    @GetMapping("/search")
    public String search(String title, Model model) {

        List<BlogBean> blogs = blogService.queryBlogByTitle(title);
        model.addAttribute("blogs", blogs);
        return "search";
    }
}
